/* $RCSFile: ADNDynUserquery.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynUserquery.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:33  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynUserquery */
/* Date 2010-01-10 19:46:49Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
	public class ADNDynUserquery : ADNDynXmlView
	{
		/* Internal class for DynTypes */
		protected class Ftor: DFactor
		{
			public Ftor() : base(CrmStr.userquery){}
			public override Type DynType
			{	get{return typeof(ADNDynUserquery);}}
			public override string DynTypename
			{	get{return CrmStr.userquery;}}
			public override DynEntity Build()
			{	return new ADNDynUserquery();}
			public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
			{	return new ADNDynUserquery(w, dEntity, wproperties, null);}
			public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
			{	return new ADNDynUserquery(w, PrimaryFieldValue);}
			public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
			{	return new ADNDynUserquery(w,PrimaryKeyValue);}
		}
		/* Static Ctor to register in DynTypes */
		static ADNDynUserquery(){new Ftor();}

		public override bool HasOwningBusinessUnitProperty
		{	get{ return true;}}
		public ADNDynUserquery(): base(){}
		public ADNDynUserquery(CRMWrapperBase w, string PrimaryFieldValue): base(w, CrmStr.userquery)
		{
			if ( PrimaryFieldValue != string.Empty )
			name	=   PrimaryFieldValue;
		}
		public ADNDynUserquery(CRMWrapperBase w, Guid CrmId): base(w,CrmStr.userquery, CrmId){}
		public ADNDynUserquery(CRMWrapperBase w, InternalDynamicEntity e): base(w,CrmStr.userquery,e,null,null){}
		public ADNDynUserquery(CRMWrapperBase w, InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s): base(w,CrmStr.userquery,e,prop,s){}
		public ADNDynUserquery(ResetWrapperHandler fn, string PrimaryFieldValue): base(fn,CrmStr.userquery)
		{
			if ( PrimaryFieldValue != string.Empty )
				name	=   PrimaryFieldValue;
		}
		public ADNDynUserquery(ResetWrapperHandler fn, Guid CrmId): base(fn,CrmStr.userquery,CrmId){}
		public ADNDynUserquery(ResetWrapperHandler fn,InternalDynamicEntity e): base(fn,CrmStr.userquery,e,null,null){}
		public ADNDynUserquery(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s): base(fn,CrmStr.userquery,e,prop,s){}

		/* Properties */

		[CrmDynAttribute(CrmStr.userquery)]
		public Guid userqueryid
		{
		    get	{	 return KeyPropertyValue(CrmStr.userqueryid);}
		    set	{	AddKeyProperty(CrmStr.userqueryid, value);}
		}
		protected override void SetCrmIdProperty(Guid crmId)
		{
			if ( !dicProperty.ContainsKey(CrmStr.userqueryid)  || KeyPropertyValue(CrmStr.userqueryid) != crmId )
				userqueryid	=   crmId;
		}
		public override Guid PrimaryKeyGuidValue
		{
		    get	{	return userqueryid;}
		    set{	userqueryid	=value;}
		}


		[CrmDynAttribute(CrmStr.userquery)]
		public Guid owningbusinessunit
		{
		    get	{	 return LookupPropertyValue(CrmStr.owningbusinessunit);}
		    set	{	AddLookupProperty(CrmStr.owningbusinessunit,CrmStr.businessunit,value);}
		}

		public string businessunitName
		{
    		get	{	 return LookupPropertyName(CrmStr.owningbusinessunit);}
		}

		[CrmDynAttribute(CrmStr.userquery)]
		public Guid owninguser
		{
		    get	{	 return LookupPropertyValue(CrmStr.owninguser);}
		    set	{	AddLookupProperty(CrmStr.owninguser,CrmStr.systemuser,value);}
		}

		public string systemuserName
		{
    		get	{	 return LookupPropertyName(CrmStr.owninguser);}
		}

	}
}